package com.funong.matrix.biz.power.facade.impl;

import cn.hutool.core.lang.tree.Tree;
import com.funong.matrix.biz.base.entity.SysMenuEntity;
import com.funong.matrix.biz.power.domain.SysMenuDomainDao;
import com.funong.matrix.biz.power.facade.SysMenuFacade;
import com.funong.matrix.biz.power.pojo.dto.SysRolePermissionDTO;
import com.funong.matrix.core.dto.QueryDTO;
import com.funong.matrix.core.dto.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author : NaNa
 * @since : 2023-05-19 17:01
 **/
@Slf4j
@Service
public class SysMenuFacadeImpl implements SysMenuFacade {
    @Resource
    private SysMenuDomainDao menuDomainDao;

    @Override
    public Result queryByCondition(QueryDTO<SysMenuEntity> queryDTO) {
        return menuDomainDao.queryByCondition(queryDTO);
    }

    @Override
    public Boolean saveOrUpdateMenu(SysMenuEntity menuEntity) {
        return menuDomainDao.saveOrUpdateMenu(menuEntity);
    }

    @Override
    public SysMenuEntity getMenuById(Integer menuId) {
        return menuDomainDao.getMenuById(menuId);
    }

    @Override
    public SysMenuEntity getMenuByCode(String code) {
        return menuDomainDao.getMenuByCode(code);
    }

    @Override
    public List<SysMenuEntity> getMenuListByRoleCodeList(List<String> roleCodeList) {
        return menuDomainDao.getMenuListByRoleCodeList(roleCodeList);
    }

    @Override
    public Boolean updateMenuStatus(Integer menuId, Integer status) {
        return menuDomainDao.updateMenuStatus(menuId, status);
    }

    @Override
    public Boolean deleteMenu(Integer menuId) {
        return menuDomainDao.deleteMenu(menuId);
    }

    @Override
    public void saveRoleMenu(SysRolePermissionDTO rolePermissionDTO) {
        menuDomainDao.saveRoleMenu(rolePermissionDTO);
    }

    @Override
    public List<SysMenuEntity> getMenuTree(Integer systemId) {
        return menuDomainDao.getMenuTree(systemId);
    }

    @Override
    public List<Tree<String>> querySelect(Integer systemId) {
        return menuDomainDao.querySelect(systemId);
    }

}
